<script setup>
	import Bottom from '../components/Bottom.vue'
	import Top from '../components/Top.vue'
	import LoginTips from '../components/LoginTips.vue'
	import {
		onMounted,
		reactive,
		getCurrentInstance
	} from 'vue'
	import {
		useRouter,
		useRoute
	} from 'vue-router'
	const {
		proxy
	} = getCurrentInstance()
	const router = useRouter()
	const route = useRoute()
	const state = reactive({
		showLogin: '',
	})
	onMounted(() => {
		if (!localStorage.getItem('token')) {
			state.showLogin = true
		}
	})

	function changeShowLogin() {
		state.showLogin = !state.showLogin
	}

	function getasideposterImg() {
		proxy.$http.get('/boot/api/comm/banner/list?pageNo=1&pageSize=100').then(res => {
			if (!res.data.success) {
				alert(res.data.message)
			} else {
				localStorage.setItem('posterData', JSON.stringify(res.data.result.records))
			}
		})
	}
	getasideposterImg()
</script>

<template>
	<div class="home">
		<LoginTips v-if="state.showLogin" @changeShowLogin="changeShowLogin" />
		<Top />
		<router-view></router-view>
		<Bottom />
	</div>
</template>

<style scoped lang="scss">
	.home {
		width: 100%;
		background-color: rgb(245, 247, 250);
		padding-top: 80px;
	}
</style>